package com.ssy.lingxi.purchase.controller.purchase;

import com.ssy.lingxi.common.controller.BaseController;
import com.ssy.lingxi.common.model.dto.UserLoginCacheDTO;
import com.ssy.lingxi.common.response.PageData;
import com.ssy.lingxi.common.response.Wrapper;
import com.ssy.lingxi.purchase.api.dto.request.BaseDetailsRequest;
import com.ssy.lingxi.purchase.api.dto.request.purchase.PurchaseInquiryListRequest;
import com.ssy.lingxi.purchase.api.dto.request.purchase.PurchaseInquiryProductRequest;
import com.ssy.lingxi.purchase.api.dto.response.purchase.PurchaseInquiryDetailsResponse;
import com.ssy.lingxi.purchase.api.dto.response.purchase.PurchaseInquiryListResponse;
import com.ssy.lingxi.purchase.service.PlatformPurchaseInquiryService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;

/**
* @menu 平台后台-采购需求单审核
* @author wrc
* @date 2021/1/9
*/
@RestController
@RequestMapping("/purchase/platform/purchase/inquiry")
public class PlatformPurchaseInquiryController extends BaseController {


    @Resource
    PlatformPurchaseInquiryService platformpurchaseInquiryService;

    /**
    *采购需求单查询
    */
    @GetMapping("/list")
    public Wrapper<PageData<PurchaseInquiryListResponse>> purchaseInquiryList(HttpServletRequest httpServletRequest, PurchaseInquiryListRequest request) {
        UserLoginCacheDTO sysUser = this.getSysUser(httpServletRequest);
        return platformpurchaseInquiryService.platformPurchaseInquiryList(request,sysUser);
    }


    /**
     *采购需求单详情
     */
    @GetMapping("/details")
    public Wrapper<PurchaseInquiryDetailsResponse> purchaseInquiryDetails(BaseDetailsRequest request, HttpServletRequest httpServletRequest ) {
        UserLoginCacheDTO sysUser = this.getSysUser(httpServletRequest);
        return platformpurchaseInquiryService.purchaseInquiryDetails(request,sysUser);
    }

    /**
     *待审核采购需求单(22.1.20版本作废)
     */
  /*  @GetMapping("/examine/list")
    public Wrapper<PageData<PurchaseInquiryListResponse>> purchaseInquiryExamineList(PurchaseInquiryListRequest request,HttpServletRequest httpServletRequest) {
        UserLoginCacheDTO sysUser = this.getSysUser(httpServletRequest);
        return platformpurchaseInquiryService.purchaseInquiryExamineList(request,sysUser);
    }*/

    /**
     *审核采购需求单(22.1.20版本作废)
     */
  /*  @PostMapping("/examine")
    public Wrapper purchaseInquiryExamine(@Valid @RequestBody BaseExamineRequest request, HttpServletRequest httpServletRequest) {
        UserLoginCacheDTO sysUser = this.getSysUser(httpServletRequest);
        return platformpurchaseInquiryService.purchaseInquiryExamine(request,sysUser);
    }
*/
    /**
     *采购询价-提交审核采购需求单批量(22.1.20版本作废)
     */
   /* @PostMapping("/examine/batch")
    public Wrapper purchaseInquiryExamineBatch(@Valid @RequestBody BaseDeleteAllRequest request, HttpServletRequest httpServletRequest) {
        UserLoginCacheDTO sysUser = this.getSysUser(httpServletRequest);
        return platformpurchaseInquiryService.purchaseInquiryExamineBatch(request,sysUser);
    }*/


    /**
     * 平台后台-采购物料-分页查询
     * @author wrc
     * @date 2020/8/3
     */
    @GetMapping("/productlist/list")
    public Wrapper<PageData<PurchaseInquiryProductRequest>> purchaseInquiryProductlist(BaseDetailsRequest request, HttpServletRequest httpServletRequest) {
        UserLoginCacheDTO sysUser = this.getSysUser(httpServletRequest);
        return platformpurchaseInquiryService.purchaseInquiryProductlist(request,sysUser);
    }

}
